#!/usr/bin/make -f

ifndef INITIALIZED
N:=2
a:=$(shell seq $(N) -1 1; echo hi 1>&2 )
b:=
c:=
F:=a
T:=b
U:=c
export a
export INITIALIZED=TRUE
endif

length=$(words $($1))
top=$(word 1,$($1))
pop=$(wordlist 2,$(words $($1)),$($1))
push=$2 $($1)

ifeq ($(N),1)
#a:=1
m:=$(call top,$(F))
$(F):=$(call pop,$(F))
$(T):=$(call push,$(T),$(m))
.PHONY:foo
foo:
	# m:=6
	@echo base
	@echo "m : $(m)"
	@echo "a : $(a)"
	@echo "b : $(b)"
	@echo "c : $(c)"
	@echo "F : $(F)"
	@echo "T : $(T)"
	@echo "U : $(U)"
else

.PHONY:foo
foo:
	@echo "a : $(a)"
	@echo "b : $(b)"
	@echo "c : $(c)"
	@echo "F : $(F)"
	@echo "T : $(T)"
	@echo "U : $(U)"
	$(MAKE) -f Makefile.hanoi N=1 F=a T=b
	@echo "a : $(a)"
	@echo "b : $(b)"
	@echo "c : $(c)"
	@echo "F : $(F)"
	@echo "T : $(T)"
	@echo "U : $(U)"

endif
